/*
 * @Author: byron
 * @Date: 2021-09-20 22:20:51
 * @LastEditTime: 2021-09-21 17:28:32
 */
import { INCREMENT, DECREMENT } from "./constant";

const initState = 0;
export default function countReducer(preState = initState, action) {
  const { type, data } = action;
  switch (type) {
    case INCREMENT:
      return preState + data;
    case DECREMENT:
      return preState - data;
    default:
      return preState;
  }
}
